package com.situ.water_system.mapper;

import com.situ.water_system.pojo.SyEmp;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Angel
 * @since 2020-12-01
 */
@Mapper
public interface SyEmpMapper extends BaseMapper<SyEmp> {
     @Select("select (select count(*) from us_user where " +
             "DATE_FORMAT(curdate(),'%Y%m') like DATE_FORMAT(createdate,'%Y%m')) user,(select count(*) from rd_read where  ReadYear " +
             "like DATE_FORMAT(curdate(),'%Y')  and ReadMonth like DATE_FORMAT(curdate(),'%m'))" +
             " meter,(select count(*) from rd_read where  ReadYear like DATE_FORMAT(curdate(),'%Y')" +
             "  and ReadMonth like DATE_FORMAT(curdate(),'%m')  and  Audit>=0)" +
             " copy,(select sum(if(t.CurValue>t.PreValue,t.CurValue-t.PreValue,t.`MaxValue`-t.PreValue+t.CurValue))" +
             " aa from rd_read t  where  t.ReadYear like DATE_FORMAT(curdate(),'%Y')  " +
             "and t.ReadMonth like DATE_FORMAT(curdate(),'%m'))  used from dual")
    public List<Map> workspace();
}
